package com.xiaoshuidi.cloud.module.member.mapper.securitycheckprogram;

import java.util.*;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.xiaoshuidi.cloud.framework.common.pojo.PageResult;
import com.xiaoshuidi.cloud.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.xiaoshuidi.cloud.framework.mybatis.core.mapper.BaseMapperX;
import com.xiaoshuidi.cloud.module.member.controller.admin.securitycheckprogram.vo.SecurityCheckProgramExportReqVO;
import com.xiaoshuidi.cloud.module.member.controller.admin.securitycheckprogram.vo.SecurityCheckProgramPageReqVO;
import com.xiaoshuidi.cloud.module.member.controller.admin.securitycheckprogram.vo.SecurityCheckProgramRespVO;
import com.xiaoshuidi.cloud.module.member.pojo.securitycheckprogram.SecurityCheckProgram;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

/**
 * 安全检查项目 Mapper
 *
 * @author hans.zhang
 */
@Mapper
public interface SecurityCheckProgramMapper extends BaseMapperX<SecurityCheckProgram> {

    Page<SecurityCheckProgramRespVO> page(Page<Object> objectPage, @Param("ew") QueryWrapper<SecurityCheckProgram> wrapper);

    List<SecurityCheckProgramRespVO> list(@Param("ew") QueryWrapper<SecurityCheckProgram> wrapper);

    @Select("SELECT DISTINCT " +
            "mscp.*  " +
            "FROM " +
            "member_security_check_program mscp " +
            "LEFT JOIN member_security_check_program_gridders mscpg ON mscp.id = mscpg.security_check_program_id and mscp.deleted = false and mscpg.deleted = false " +
            "WHERE " +
            "mscpg.gridders_id = #{loginUserId} and mscp.status = true")
    List<SecurityCheckProgram> getMyProgram(@Param("loginUserId") Long loginUserId);
}
